	#include <iostream>
	#include <algorithm>
	
	#define x first
	#define y second
	
	using namespace std;
	
	typedef pair<int, int> PII;
	
	const int N = 1e3 + 10;
	
	PII q[N];
	int n;
	
	
	int main()
	{
		cin >> n;
		for (int i = 1; i <= n; i ++ )
		{
			int v;
			cin >> v;
			
			q[i] = {v, i};
		}
		
		sort(q + 1, q + n + 1);
		
		long long sum = 0;
		
		for (int i = 1; i <= n; i ++ )
		{
			cout << q[i].y << ' ';
			sum += (n - i) * q[i].x;
		}
		
		cout << endl;
		printf("%.2lf", sum * 1.0 / n);
		return 0;
	}
